﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Runtime.InteropServices;
using System.Media;
using System.Windows.Forms;
using System.Threading;

namespace WcfService1
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    public class Service1 : IService1
    {
        [DllImport("C:\\Users\\gabriel\\Documents\\ ProjetosSVN\\QuickPlay 2\\Cliente\\Cliente\\Controle\\VirtualKey.dll")]
        private static extern void PlayKey();

        [DllImport("C:\\Users\\gabriel\\Documents\\ ProjetosSVN\\QuickPlay 2\\Cliente\\Cliente\\Controle\\VirtualKey.dll")]
        private static extern void MuteKey();

        [DllImport("C:\\Users\\gabriel\\Documents\\ ProjetosSVN\\QuickPlay 2\\Cliente\\Cliente\\Controle\\VirtualKey.dll")]
        private static extern void MaisVolumeKey();

        [DllImport("C:\\Users\\gabriel\\Documents\\ ProjetosSVN\\QuickPlay 2\\Cliente\\Cliente\\Controle\\VirtualKey.dll")]
        private static extern void MenosVolumeKey();

        [DllImport("C:\\Users\\gabriel\\Documents\\ ProjetosSVN\\QuickPlay 2\\Cliente\\Cliente\\Controle\\VirtualKey.dll")]
        private static extern void MenosVolumeKeyDown();

        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }

        public void Play()
        {
            PlayKey();
        }

        public void Mute()
        {
            MuteKey();
        }


        public void MaisVolume()
        {
            MaisVolumeKey();
        }

        public void MenosVolume()
        {
            MenosVolumeKey();
        }

        public void ControleVolume(int Volume)
        {
            for (int x = 0; x < 50; x++)
            {
                MenosVolume();
            }

            int aux = (int)(Volume / 2);
            for (int x = 2; x <= aux; x++)
            {
                MaisVolume();
            }
        }
    }
}